1 using UnityEngine;
2 using
System.Collections;
3
4 public
class GUIFriendsInRoom : MonoBehaviour
5 {
6     
public Rect GuiRect;
7
8
9     
void Start()
10     {
11         GuiRect =
new Rect(Screen.width / 4, 80, Screen.width / 2, Screen.height - 100);
12     }
13
14     
15     
public void OnGUI()
16     {
17         
if (PhotonNetwork.connectionStateDetailed != PeerState.Joined)
18         {
19             
return;
20         }
21
22         GUILayout.BeginArea(GuiRect);
23
24         GUILayout.Label(
"In-Game");
25         GUILayout.Label(
"For simplicity, this demo just shows the players in this room. The list will expand when more join.");
26         GUILayout.Label(
"Your (random) name: " + PhotonNetwork.playerName);
27         GUILayout.Label(PhotonNetwork.playerList.Length +
" players in this room.");
28         GUILayout.Label(
"The others are:");
29         
foreach (PhotonPlayer player in PhotonNetwork.otherPlayers)
30         {
31             GUILayout.Label(player.ToString());
32         }
33
34         
if (GUILayout.Button("Leave"))
35         {
36             PhotonNetwork.LeaveRoom();
37         }
38         GUILayout.EndArea();
39     }
40 }



Trò chơi Tic-Tac-Toe, game đánh caro full source code 53.555 lượt xem

Gõ tìm kiếm nhanh...